import { SWFInfo } from "../../../../com/gengine/resource/info/SWFInfo";
import { BrowerUtil } from "../../../../com/gengine/utils/BrowerUtil";
import { ParamsConst } from "../../../common/global/ParamsConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { Language } from "../../../../extend/language/Language";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { ObjCreate } from "../common/ObjCreate";
import { LoginNoticeBody } from "./LoginNoticeBody";
import { GBoxDirection } from "../../../../com/mui/containers/globalVariable/GBoxDirection";
import { GScrollPane } from "../../../../com/mui/controls/GScrollPane";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { LoaderManager } from "../../../../com/gengine/resource/LoaderManager";
import { StaticResUrl } from "../../resource/StaticResUrl";
import { FlowerBg } from "../common/FlowerBg";
type int = number;
//class LoginNoticePanel
    
    export  class LoginNoticePanel /* flash.display.Sprite */
    {
        constructor(arg1: int, arg2: int)
        {
            
            this._width = arg1;
            this._height = arg2;
            this.initUI();
            return;
        }

        protected onLoginBgLoadedHandler(arg1: SWFInfo): void
        {
            if (arg1 && arg1.clip) 
            {
                addChildAt(arg1.clip, 0);
            }
            return;
        }

        protected onGotoWebHomeClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            BrowerUtil.getUrl(ParamsConst.instance.actimUrl);
            return;
        }

        protected initUI(): void
        {
            flash.utils.setTimeout(this.loadBgImg, 1500);
            this._titleTxt = new Object /* flash.text.TextField */();
            var loc1=new GTextFormat(FontUtil.lishuName, 22, 16776960);
            this._titleTxt.defaultTextFormat = loc1;
            this._titleTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._titleTxt.width = this.width;
            this._titleTxt.height = 30;
            this._titleTxt.mouseEnabled = false;
            this._titleTxt.filters = [FilterConst.glowFilter];
            this._titleTxt.x = this.width / 2;
            this._titleTxt.y = 5;
            this._titleTxt.text = Language.getString(20622);
            addChild(this._titleTxt);
            this._line = GlobalClass.getBitmap(ImagesConst.SplitLine);
            this._line.width = this.width;
            this._line.y = this._titleTxt.y + this._titleTxt.textHeight + 10;
            addChild(this._line);
            this._flowerBg = ObjCreate.createFlowerBg(7, this._line.y + 5, this.width - 14, this.height - (this._line.y + 5) - 5, this, false);
            this._bodySprite = new LoginNoticeBody();
            this._bodySprite.direction = GBoxDirection.VERTICAL;
            this._bodySprite.verticalGap = 2;
            this._scrollPane = new GScrollPane();
            this._scrollPane.x = 5;
            this._scrollPane.y = this._line.y + 5;
            this._scrollPane.width = this.width - 10;
            this._scrollPane.height = this.height - this._scrollPane.y;
            this._scrollPane.styleName = "GScrollPane";
            this._scrollPane.verticalScrollPolicy = ScrollPolicy.AUTO;
            this._scrollPane.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._scrollPane.source = this._bodySprite;
            this._scrollPane.scrollDrag = false;
            addChild(this._scrollPane);
            this._gotoWebHome = new Object /* flash.text.TextField */();
            var loc2=new GTextFormat("", 12, 65280);
            loc2.underline = true;
            this._gotoWebHome.defaultTextFormat = loc2;
            this._gotoWebHome.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._gotoWebHome.width = 120;
            this._gotoWebHome.height = 18;
            this._gotoWebHome.filters = [FilterConst.glowFilter];
            this._gotoWebHome.htmlText = "<a href=\'event: 0\'>" + HTMLUtil.addColor(Language.getString(20623), "#00ff00") + "</a>";
            this._gotoWebHome.x = this.width - this._gotoWebHome.textWidth - 20;
            this._gotoWebHome.y = 15;
            this._gotoWebHome.addEventListener(flash.events.MouseEvent.CLICK, this.onGotoWebHomeClickHandler);
            addChild(this._gotoWebHome);
            return;
        }

        protected loadBgImg(): void
        {
            LoaderManager.instance.load(StaticResUrl.loginNoticeBg, this.onLoginBgLoadedHandler);
            return;
        }

        public updateData(arg1: Array<any>, arg2: Array<any>): void
        {
            this._bodySprite.clearVersion();
            this._bodySprite.addList(arg1);
            this._bodySprite.updateList(arg2);
            this._bodySprite.updatePox(20);
            this._bodySprite.invalidate();
            this._scrollPane.refreshPane();
            this._scrollPane.update();
            this._bodySprite.updateBgSize();
            return;
        }

        public /* override */ get width(): number
        {
            return this._width;
        }

        public /* override */ get height(): number
        {
            return this._height;
        }

        protected /* var */_titleTxt: Object /* flash.text.TextField */;

        protected /* var */_line: Object /* flash.display.Bitmap */;

        protected /* var */_scrollPane: GScrollPane;

        protected /* var */_bodySprite: LoginNoticeBody;

        protected /* var */_gotoWebHome: Object /* flash.text.TextField */;

        protected /* var */_flowerBg: FlowerBg;

        protected /* var */_width: int;

        protected /* var */_height: int;
    }
